package com.orange.cetback.controller.user;

import com.orange.cetback.common.vo.Result;
import com.orange.cetback.pojo.dto.WritingDTO;
import com.orange.cetback.pojo.vo.*;
import com.orange.cetback.service.MaterialsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenenjun
 * @since 2025-02-16
 */
@Tag(name = "试卷材料接口")
@RestController
@RequestMapping("/userApi/materials")
public class MaterialsController {
    @Autowired
    private MaterialsService materialsService;

    @Operation(summary = "获取试卷原材料")
    @GetMapping("/list")
    public Result<List<VocabularyVO>> list(@RequestParam Integer paperId){
        List<VocabularyVO> list = materialsService.MaterialList(paperId);
        return Result.success(list);
    }

    @Operation(summary = "获取词汇理解")
    @GetMapping("/vocabulary")
    public Result<VocabularyVO> vocabulary(@RequestParam Integer paperId){
        VocabularyVO vocabulary = materialsService.vocabulary(paperId);
        return Result.success(vocabulary);
    }

    @Operation(summary = "获取长阅读")
    @GetMapping("/longReading")
    public Result<LongReadingVO> longReading(@RequestParam Integer paperId){
        LongReadingVO longReading = materialsService.longReading(paperId);
        return Result.success(longReading);
    }

    @Operation(summary = "获取仔细阅读")
    @GetMapping("/carefulReading")
    public Result<List<CarefulReadingVO>> carefulReading(@RequestParam Integer paperId){
        List<CarefulReadingVO> carefulReadingVO = materialsService.carefulReading(paperId);
        return Result.success(carefulReadingVO);
    }

    @Operation(summary = "获取写作")
    @GetMapping("/writing")
    public Result<WritingVO> writing(@RequestParam Integer paperId){
        WritingVO writing = materialsService.writing(paperId);
        return Result.success(writing);
    }

    @Operation(summary = "获取翻译")
    @GetMapping("/translation")
    public Result<TranslationVO> translation(@RequestParam Integer paperId){
        TranslationVO translation = materialsService.translation(paperId);
        return Result.success(translation);
    }

}
